import json

def save_qa_data(qa_data, format='json'):
    if format == 'json':
        with open('jdl_qa_dataset.json', 'w', encoding='utf-8') as f:
            json.dump(qa_data, f, ensure_ascii=False, indent=2)

    elif format == 'csv':
        import pandas as pd
        df = pd.DataFrame(qa_data)
        df.to_csv('jdl_qa_dataset.csv', index=False, encoding='utf-8-sig')